<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>jQuery plugin: Tablesorter 2.0 - jQuery UITheme Widget (jQuery UI)</title>

	<!-- jQuery -->
	<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2/jquery.min.js"></script>

	<!-- Demo stuff -->
	<link rel="stylesheet" href="css/jq.css">
	<link href="css/prettify.css" rel="stylesheet">
	<script src="js/prettify.js"></script>
	<script src="js/docs.js"></script>

	<!-- Tablesorter: required; also include any of the jQuery UI themes -->
	<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/cupertino/jquery-ui.css">
	<link rel="stylesheet" href="../css/theme.jui.css">

	<script src="../js/jquery.tablesorter.js"></script>
	<script src="../js/jquery.tablesorter.widgets.js"></script>

	<!-- Tablesorter: optional -->
	<!-- <script src="../addons/pager/jquery.tablesorter.pager.js"></script> -->

	<script id="js">$(function() {

	// Extend the themes to change any of the default class names ** NEW **
	$.extend($.tablesorter.themes.jui, {
		// change default jQuery uitheme icons - find the full list of icons here: http://jqueryui.com/themeroller/ (hover over them for their name)
		table      : 'ui-widget ui-widget-content ui-corner-all', // table classes
		header     : 'ui-widget-header ui-corner-all ui-state-default', // header classes
		footerRow  : '',
		footerCells: '',
		icons      : 'ui-icon', // icon class added to the <i> in the header
		sortNone   : 'ui-icon-carat-2-n-s',
		sortAsc    : 'ui-icon-carat-1-n',
		sortDesc   : 'ui-icon-carat-1-s',
		active     : 'ui-state-active', // applied when column is sorted
		hover      : 'ui-state-hover',  // hover class
		filterRow  : '',
		even       : 'ui-widget-content', // odd row zebra striping
		odd        : 'ui-state-default'   // even row zebra striping
	});

	// call the tablesorter plugin and apply the ui theme widget
	$("table").tablesorter({

		theme : 'jui', // theme "jui" and "bootstrap" override the uitheme widget option in v2.7+

		headerTemplate : '{content} {icon}', // needed to add icon for jui theme

		// widget code now contained in the jquery.tablesorter.widgets.js file
		widgets : ['uitheme', 'zebra'],

		widgetOptions : {
			// zebra striping class names - the uitheme widget adds the class names defined in
			// $.tablesorter.themes to the zebra widget class names
			zebra   : ["even", "odd"],

			// set the uitheme widget to use the jQuery UI theme class names
			// ** this is now optional, and will be overridden if the theme name exists in $.tablesorter.themes **
			// uitheme : 'jui'
		}

	});

});</script>

</head>
<body>

<div id="banner">
	<h1>table<em>sorter</em></h1>
	<h2>jQuery UITheme Widget (jQuery UI)</h2>
	<h3>Flexible client-side table sorting</h3>
	<a href="index.html">Back to documentation</a>
</div>

<div id="main">

	<p class="tip">
		<em>NOTE!</em>
		<ul>
			<li>As of tablesorter version 2.9+, this widget can no longer be applied to versions of tablesorter prior to version 2.8.</li>
			<li>You will need to modify the <code>headerTemplate</code> option to include the bootstrap icon! See the example in the code (v2.7).</li>
			<li>The original "widgetUitheme" option has been replaced by "widgetOptions.uitheme". See the javascript block below for more details (v2.1).</li>
			<li>In tablesorter v2.4, the <code>uitheme</code> option has changed to indicate the theme instead of an array of icons to use:
				<ul>
					<li>All theme class names are now contained within <code>$.tablesorter.themes</code> with the jQuery UI theme saved to <code>$.tablesorter.themes.jui</code></li>
					<li>The themes variable allows you to modify the class names for the table, header, sort icons, active state, hover state, filter inputs and zebra striping. See the code below on how to extend these variables.</li>
					<li>Set the <code>uitheme</code> widget option to <code>"jui"</code> to set the widget to use the jQuery UI theme. See the <a href="example-widget-bootstrap-theme.html">bootstrap demo</a> for another example.</li>
				</ul>
			</li>
			<li>Earlier widget versions required jQuery 1.4+. The UITheme widget for tablesorter 2.4+ requires jQuery 1.2.6+.</li>
		</ul>
	</p>

	<h1>Demo</h1>
	<br>
	jQuery UI Theme:
	<div id="switcher"></div>
	<br>

	<div id="demo"><table class="tablesorter">
	<thead>
		<tr>
			<th>First Name</th>
			<th>Last Name</th>
			<th>Age</th>
			<th>Total</th>
			<th>Discount</th>
			<th>Date</th>
		</tr>
	</thead>
	<tfoot>
		<tr>
			<th>First Name</th>
			<th>Last Name</th>
			<th>Age</th>
			<th>Total</th>
			<th>Discount</th>
			<th>Date</th>
		</tr>
	</tfoot>
	<tbody>
		<tr>
			<td>Peter</td>
			<td>Parker</td>
			<td>28</td>
			<td>$9.99</td>
			<td>20%</td>
			<td>Jul 6, 2006 8:14 AM</td>
		</tr>
		<tr>
			<td>John</td>
			<td>Hood</td>
			<td>33</td>
			<td>$19.99</td>
			<td>25%</td>
			<td>Dec 10, 2002 5:14 AM</td>
		</tr>
		<tr>
			<td>Clark</td>
			<td>Kent</td>
			<td>18</td>
			<td>$15.89</td>
			<td>44%</td>
			<td>Jan 12, 2003 11:14 AM</td>
		</tr>
		<tr>
			<td>Bruce</td>
			<td>Almighty</td>
			<td>45</td>
			<td>$153.19</td>
			<td>44%</td>
			<td>Jan 18, 2001 9:12 AM</td>
		</tr>
		<tr>
			<td>Bruce</td>
			<td>Evans</td>
			<td>22</td>
			<td>$13.19</td>
			<td>11%</td>
			<td>Jan 18, 2007 9:12 AM</td>
		</tr>
	</tbody>
</table></div>


	<h1>Page Header</h1>
	<div>
		<pre class="prettyprint lang-html">&lt;!-- ui theme stylesheet - contents shown below --&gt;
&lt;link rel=&quot;stylesheet&quot; href=&quot;../css/theme.jui.css&quot;&gt;
&lt;!-- jQuery UI theme (cupertino example here) --&gt;
&lt;link rel=&quot;stylesheet&quot; href=&quot;http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/cupertino/jquery-ui.css&quot;&gt;

&lt;!-- tablesorter plugin --&gt;
&lt;script src=&quot;../js/jquery.tablesorter.js&quot;&gt;&lt;/script&gt;
&lt;!-- tablesorter widget file - loaded after the plugin --&gt;
&lt;script src=&quot;../js/jquery.tablesorter.widgets.js&quot;&gt;&lt;/script&gt;</pre>
	</div>

	<h1>Javascript</h1>
	<div id="javascript">
		<pre class="prettyprint lang-javascript"></pre>
	</div>

	<h1>HTML</h1>
	<div id="html">
		<pre class="prettyprint lang-html"></pre>
	</div>

<div class="next-up">
	<hr />
	Next up: <a href="example-widget-bootstrap-theme.html">UITheme widget - Bootstrap theme &rsaquo;&rsaquo;</a><br>
	Second time around: <a href="example-option-render-header.html">Modifying the Header during rendering &rsaquo;&rsaquo;</a>
</div>

</div>

</body>
</html>

